# 	$Id: Makefile 15 2008-07-29 04:53:41Z phrakt $
#
#

.include "../../share/mk/own.mk"

PROTOID_SRC=	proto_ids.src
PROTOID_HDR=	${PROTOID_SRC:.src=.h}


LIB=	pforge
MAN=	pforge.3

HDRS=	pforge.h addr.h buf.h conf.h dlink.h if.h log.h module.h \
	pbuf.h pkt.h proto.h ${PROTOID_HDR}
SRCS=	buf.c ctx.c dlink.c dlink_pcap.c error.c \
	if.c log.c md5.c mem.c mib.c module.c mpool.c \
	pbuf.c pcap.c pforge.c pkt.c proto.c rand.c swtab.c

CLEANFILES= ${.CURDIR}/${PROTOID_HDR}

.PATH:	${.CURDIR}/os

.if !empty(OS:L:M*bsd)
SRCS+=	bsd.c
.elif !empty(OS:L:Mlinux)
SRCS+=	linux.c
.elif !empty(OS:L:Msolaris)
SRCS+=	solaris.c
.endif

CFLAGS=  -pipe -I${.CURDIR} -DDLINK_BPF -DDLINK_PCAP
CFLAGS+= -Wstrict-prototypes -Wmissing-prototypes
CFLAGS+= -Wmissing-declarations -Wshadow -Wcast-qual
CFLAGS+= -Wpointer-arith -Wsign-compare
YFLAGS=



# Override default 'all' target
all: ${PROTOID_HDR} ${_LIBS} _SUBDIRUSE

# Override the default Yacc targets to avoid conflicts
.y.c:
	${YACC} ${YFLAGS} -p ${.IMPSRC:T:R} ${.IMPSRC}
	mv y.tab.c ${.TARGET}

.y.o:
	${YACC} ${YFLAGS} -p ${.TARGET:R} ${.IMPSRC}
	${COMPILE.c} -o ${.TARGET} y.tab.c
	rm y.tab.c



${PROTOID_HDR}: ${PROTOID_SRC}
	@echo "Rebuilding protocol ID header"

#	@genproto.pl ${.CURDIR}/${PROTOID_SRC} ${.CURDIR}/${PROTOID_HDR}

.include "../../share/mk/lib.mk"
